<?php

namespace app\controller\api\sdk;

use app\model\sdk\Orders;
use support\Request;

class OrderController
{
    public function info(Request $request)
    {
        $trade_no = $request->input('trade_no');
        if (!$trade_no) {
            return yqerr(6001);
        }

        $order = Orders::where('trade_no', $trade_no)->first(['id', 'trade_no', 'status']);
        if (!$order) {
            return yqerr(6002);
        }

        return yqok([
            'trade_no' => $trade_no,
            'status' => $order->status,
        ]);
    }
}
